package game.editer;

import hx.layout.AnchorLayout;
import game.editer.ui.Config;
import hx.display.Label;
import hx.layout.AnchorLayoutData;
import hx.display.Quad;
import hx.display.Box;

/**
 * 基础的背景框编辑器功能组件
 */
class BasePanel extends Box {
	public var title:String;

	public var label:Label;

	public function new(title:String) {
		this.title = title;
		super();
	}

	override function onInit() {
		super.onInit();

		this.layout = new AnchorLayout();

		var bg = new Quad(100, 100, 0x2e2e2e);
		this.addChild(bg);
		bg.layoutData = AnchorLayoutData.fill(0);

		var quad = new Quad(100, 100, 0x4f4f4f);
		this.addChild(quad);
		quad.layoutData = AnchorLayoutData.fill(1);

		var line = new Quad(1, 1, 0x2e2e2e);
		this.addChild(line);
		line.layoutData = new AnchorLayoutData(null, 0, null, 0);
		line.y = 35;

		label = new Label(title, Config.COMMON_TEXT_FORMAT);
		this.addChild(label);
		label.x = label.y = 10;
	}
}
